/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FormPrincipal.java
 *
 * Created on 02/12/2011, 21:23:43
 */

package sistemachamados.view;

import classes.Usuario;
import org.jdesktop.application.Action;

/**
 *
 * @author Cleber Lopes
 */
public class FormPrincipal extends javax.swing.JFrame {

    private Usuario usuarioLogado;

    /** Creates new form FormPrincipal */
    public FormPrincipal() {
        initComponents();
    }

    public FormPrincipal(Usuario usuarioLogado)
    {
        initComponents();
        this.usuarioLogado = usuarioLogado;
        txfUsuarioLogado.setText(usuarioLogado.getNome());
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextField1 = new javax.swing.JTextField();
        txfUsuarioLogado = new javax.swing.JTextField();
        jButton4 = new javax.swing.JButton();
        btnAbrirChamado = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jDeskPnlChildForms = new javax.swing.JDesktopPane();
        jButton8 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        btnCidade = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jButton10 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        btnEstado = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        btnCategoriaChamado = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        btnUsuario = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        btnUnidade = new javax.swing.JButton();
        btnDivisao = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        btnSetor = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de Chamados DPLivrator - 17122011r78");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setMinimumSize(new java.awt.Dimension(1300, 690));
        getContentPane().setLayout(null);

        jTextField1.setEditable(false);
        jTextField1.setBorder(null);
        jTextField1.setName("jTextField1"); // NOI18N
        jTextField1.setOpaque(false);
        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });
        getContentPane().add(jTextField1);
        jTextField1.setBounds(520, 50, 240, 20);

        txfUsuarioLogado.setEditable(false);
        txfUsuarioLogado.setFont(new java.awt.Font("Tahoma", 1, 28));
        txfUsuarioLogado.setForeground(new java.awt.Color(255, 255, 255));
        txfUsuarioLogado.setText("cvbbcvbcvb");
        txfUsuarioLogado.setBorder(null);
        txfUsuarioLogado.setName("txfUsuarioLogado"); // NOI18N
        txfUsuarioLogado.setOpaque(false);
        getContentPane().add(txfUsuarioLogado);
        txfUsuarioLogado.setBounds(220, 50, 240, 30);

        jButton4.setFont(new java.awt.Font("Lucida Console", 0, 20));
        jButton4.setForeground(new java.awt.Color(51, 0, 51));
        jButton4.setText("Seus Chamado");
        jButton4.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButton4.setName("jButton4"); // NOI18N
        getContentPane().add(jButton4);
        jButton4.setBounds(100, 550, 190, 30);

        btnAbrirChamado.setFont(new java.awt.Font("Lucida Console", 0, 20));
        btnAbrirChamado.setForeground(new java.awt.Color(51, 0, 51));
        btnAbrirChamado.setText("Abrir");
        btnAbrirChamado.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnAbrirChamado.setName("btnAbrirChamado"); // NOI18N
        btnAbrirChamado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAbrirChamadoActionPerformed(evt);
            }
        });
        getContentPane().add(btnAbrirChamado);
        btnAbrirChamado.setBounds(100, 300, 190, 30);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(FormPrincipal.class, this);
        jButton6.setAction(actionMap.get("btnEncerrarChamadoActionPerformed")); // NOI18N
        jButton6.setFont(new java.awt.Font("Lucida Console", 0, 20));
        jButton6.setForeground(new java.awt.Color(51, 0, 51));
        jButton6.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButton6.setName("jButton6"); // NOI18N
        getContentPane().add(jButton6);
        jButton6.setBounds(100, 350, 190, 30);

        jButton7.setFont(new java.awt.Font("Lucida Console", 0, 20));
        jButton7.setForeground(new java.awt.Color(51, 0, 51));
        jButton7.setText("Seu Chamado");
        jButton7.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButton7.setName("jButton7"); // NOI18N
        getContentPane().add(jButton7);
        jButton7.setBounds(100, 400, 190, 30);

        jDeskPnlChildForms.setBackground(new java.awt.Color(204, 255, 255));
        jDeskPnlChildForms.setFocusTraversalPolicy(null);
        jDeskPnlChildForms.setName("jDeskPnlChildForms"); // NOI18N
        jDeskPnlChildForms.setOpaque(false);
        getContentPane().add(jDeskPnlChildForms);
        jDeskPnlChildForms.setBounds(360, 180, 990, 470);

        jButton8.setFont(new java.awt.Font("Lucida Console", 0, 20));
        jButton8.setForeground(new java.awt.Color(51, 0, 51));
        jButton8.setText("Nosso Chamado");
        jButton8.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButton8.setName("jButton8"); // NOI18N
        getContentPane().add(jButton8);
        jButton8.setBounds(100, 450, 190, 30);

        jButton9.setFont(new java.awt.Font("Lucida Console", 0, 20));
        jButton9.setForeground(new java.awt.Color(51, 0, 51));
        jButton9.setText("Vosso Chamado");
        jButton9.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButton9.setName("jButton9"); // NOI18N
        getContentPane().add(jButton9);
        jButton9.setBounds(100, 500, 190, 30);

        btnCidade.setAction(actionMap.get("btnCidadeActionPerformed")); // NOI18N
        btnCidade.setFont(new java.awt.Font("Ebrima", 2, 20));
        btnCidade.setForeground(new java.awt.Color(255, 255, 255));
        btnCidade.setBorder(null);
        btnCidade.setBorderPainted(false);
        btnCidade.setContentAreaFilled(false);
        btnCidade.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnCidade.setName("btnCidade"); // NOI18N
        getContentPane().add(btnCidade);
        btnCidade.setBounds(140, 100, 70, 30);

        jButton2.setFont(new java.awt.Font("Ebrima", 2, 20));
        jButton2.setForeground(new java.awt.Color(255, 255, 255));
        jButton2.setText("Sair");
        jButton2.setBorder(null);
        jButton2.setBorderPainted(false);
        jButton2.setContentAreaFilled(false);
        jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButton2.setName("jButton2"); // NOI18N
        getContentPane().add(jButton2);
        jButton2.setBounds(1280, 60, 50, 30);

        jLabel3.setFont(new java.awt.Font("Arial Narrow", 0, 18));
        jLabel3.setText("|");
        jLabel3.setEnabled(false);
        jLabel3.setName("jLabel3"); // NOI18N
        getContentPane().add(jLabel3);
        jLabel3.setBounds(1270, 50, 10, 50);

        jButton10.setAction(actionMap.get("btnAlterarSenhaActionPerformed")); // NOI18N
        jButton10.setFont(new java.awt.Font("Ebrima", 2, 20));
        jButton10.setForeground(new java.awt.Color(255, 255, 255));
        jButton10.setBorder(null);
        jButton10.setBorderPainted(false);
        jButton10.setContentAreaFilled(false);
        jButton10.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButton10.setName("jButton10"); // NOI18N
        getContentPane().add(jButton10);
        jButton10.setBounds(1130, 60, 130, 30);

        jLabel4.setFont(new java.awt.Font("Arial Narrow", 0, 20));
        jLabel4.setText("|");
        jLabel4.setEnabled(false);
        jLabel4.setName("jLabel4"); // NOI18N
        getContentPane().add(jLabel4);
        jLabel4.setBounds(220, 70, 10, 80);

        btnEstado.setAction(actionMap.get("btnEstadoActionPerformed")); // NOI18N
        btnEstado.setFont(new java.awt.Font("Ebrima", 2, 20));
        btnEstado.setForeground(new java.awt.Color(255, 255, 255));
        btnEstado.setBorder(null);
        btnEstado.setBorderPainted(false);
        btnEstado.setContentAreaFilled(false);
        btnEstado.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnEstado.setName("btnEstado"); // NOI18N
        getContentPane().add(btnEstado);
        btnEstado.setBounds(230, 100, 80, 30);

        jLabel5.setFont(new java.awt.Font("Arial Narrow", 0, 20));
        jLabel5.setText("|");
        jLabel5.setEnabled(false);
        jLabel5.setName("jLabel5"); // NOI18N
        getContentPane().add(jLabel5);
        jLabel5.setBounds(320, 70, 10, 80);

        btnCategoriaChamado.setAction(actionMap.get("btnCategoriaChamadoActionPerformed")); // NOI18N
        btnCategoriaChamado.setFont(new java.awt.Font("Ebrima", 2, 20));
        btnCategoriaChamado.setForeground(new java.awt.Color(255, 255, 255));
        btnCategoriaChamado.setBorder(null);
        btnCategoriaChamado.setBorderPainted(false);
        btnCategoriaChamado.setContentAreaFilled(false);
        btnCategoriaChamado.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnCategoriaChamado.setName("btnCategoriaChamado"); // NOI18N
        getContentPane().add(btnCategoriaChamado);
        btnCategoriaChamado.setBounds(660, 100, 220, 30);

        jLabel6.setFont(new java.awt.Font("Arial Narrow", 0, 20));
        jLabel6.setText("|");
        jLabel6.setEnabled(false);
        jLabel6.setName("jLabel6"); // NOI18N
        getContentPane().add(jLabel6);
        jLabel6.setBounds(880, 70, 10, 80);

        btnUsuario.setAction(actionMap.get("btnSetorActionPerformed")); // NOI18N
        btnUsuario.setFont(new java.awt.Font("Ebrima", 2, 20));
        btnUsuario.setForeground(new java.awt.Color(255, 255, 255));
        btnUsuario.setBorder(null);
        btnUsuario.setBorderPainted(false);
        btnUsuario.setContentAreaFilled(false);
        btnUsuario.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnUsuario.setName("btnUsuario"); // NOI18N
        btnUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuarioActionPerformed(evt);
            }
        });
        getContentPane().add(btnUsuario);
        btnUsuario.setBounds(900, 100, 90, 30);

        jLabel7.setFont(new java.awt.Font("Arial Narrow", 0, 20));
        jLabel7.setText("|");
        jLabel7.setEnabled(false);
        jLabel7.setName("jLabel7"); // NOI18N
        getContentPane().add(jLabel7);
        jLabel7.setBounds(650, 70, 10, 80);

        btnUnidade.setAction(actionMap.get("btnUnidadeActionPerformed")); // NOI18N
        btnUnidade.setFont(new java.awt.Font("Ebrima", 2, 20));
        btnUnidade.setForeground(new java.awt.Color(255, 255, 255));
        btnUnidade.setBorder(null);
        btnUnidade.setBorderPainted(false);
        btnUnidade.setContentAreaFilled(false);
        btnUnidade.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnUnidade.setName("btnUnidade"); // NOI18N
        getContentPane().add(btnUnidade);
        btnUnidade.setBounds(330, 100, 90, 30);

        btnDivisao.setAction(actionMap.get("btnDivisaoActionPerformed")); // NOI18N
        btnDivisao.setFont(new java.awt.Font("Ebrima", 2, 20));
        btnDivisao.setForeground(new java.awt.Color(255, 255, 255));
        btnDivisao.setBorder(null);
        btnDivisao.setBorderPainted(false);
        btnDivisao.setContentAreaFilled(false);
        btnDivisao.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnDivisao.setName("btnDivisao"); // NOI18N
        getContentPane().add(btnDivisao);
        btnDivisao.setBounds(440, 100, 90, 30);

        jLabel8.setFont(new java.awt.Font("Arial Narrow", 0, 20));
        jLabel8.setText("|");
        jLabel8.setEnabled(false);
        jLabel8.setName("jLabel8"); // NOI18N
        getContentPane().add(jLabel8);
        jLabel8.setBounds(430, 70, 10, 80);

        jLabel9.setFont(new java.awt.Font("Arial Narrow", 0, 20));
        jLabel9.setText("|");
        jLabel9.setEnabled(false);
        jLabel9.setName("jLabel9"); // NOI18N
        getContentPane().add(jLabel9);
        jLabel9.setBounds(540, 70, 10, 80);

        jLabel2.setFont(new java.awt.Font("Ebrima", 2, 20));
        jLabel2.setForeground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("CHAMADO");
        jLabel2.setName("jLabel2"); // NOI18N
        getContentPane().add(jLabel2);
        jLabel2.setBounds(150, 250, 110, 30);

        btnSetor.setAction(actionMap.get("btnSetorActionPerformed")); // NOI18N
        btnSetor.setFont(new java.awt.Font("Ebrima", 2, 20));
        btnSetor.setForeground(new java.awt.Color(255, 255, 255));
        btnSetor.setBorder(null);
        btnSetor.setBorderPainted(false);
        btnSetor.setContentAreaFilled(false);
        btnSetor.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnSetor.setName("btnSetor"); // NOI18N
        btnSetor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSetorActionPerformed(evt);
            }
        });
        getContentPane().add(btnSetor);
        btnSetor.setBounds(550, 100, 90, 30);

        jLabel1.setBackground(new java.awt.Color(255, 255, 255));
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemachamados/view/resources/FORM PRINCIPAL(1366X710)CXBIG2.png"))); // NOI18N
        jLabel1.setAlignmentY(0.0F);
        jLabel1.setName("jLabel1"); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 1366, 710);
        jLabel1.getAccessibleContext().setAccessibleParent(this);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnAbrirChamadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAbrirChamadoActionPerformed
        // TODO add your handling code here:
        try{
            if(formAberturaChamados==null){
                formAberturaChamados = new FormAberturaChamados(usuarioLogado);
            }
            jDeskPnlChildForms.add(formAberturaChamados);
        }catch(Exception excessao){
            
        }
        formAberturaChamados.setVisible(true);

    }//GEN-LAST:event_btnAbrirChamadoActionPerformed

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1ActionPerformed

    private void btnUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuarioActionPerformed
        // TODO add your handling code here:
        FormUsuariosAcessos f = new FormUsuariosAcessos();
        jDeskPnlChildForms.add(f);
        f.setVisible(true);
    }//GEN-LAST:event_btnUsuarioActionPerformed

    private void btnSetorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetorActionPerformed
        // TODO add your handling code here:
        FormSetor f = new FormSetor();
        jDeskPnlChildForms.add(f);
        f.setVisible(true);
    }//GEN-LAST:event_btnSetorActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FormPrincipal().setVisible(true);
            }
        });
    }

    @Action
    public void btnCidadeActionPerformed() {
        try{
            if(formCidades==null)
            {
                formCidades = new FormCidades();
            }
            jDeskPnlChildForms.add(formCidades);
        }catch(Exception excessao){

        }
        formCidades.setVisible(true);
    }

    @Action
    public void btnEstadoActionPerformed() {
       try{
           if(formEstados==null)
           {
               formEstados = new FormEstados(usuarioLogado);
           }
           jDeskPnlChildForms.add(formEstados);
       }catch(Exception excessao){

       }
       formEstados.setVisible(true);
    }

    @Action
    public void btnUnidadeActionPerformed() {
        try{
            if(formLocal==null)
            {
                formLocal = new FormLocal();
            }
            jDeskPnlChildForms.add(formLocal);
        }catch(Exception excessao){
            
        }
        formLocal.setVisible(true);
    }

    @Action
    public void btnDivisaoActionPerformed() {
        // TODO add your handling code here:
        try{
            if(formUnidade==null)
            {
                formUnidade = new FormUnidade();
            }
            jDeskPnlChildForms.add(formUnidade);
        }catch(Exception excessao){

        }
        formUnidade.setVisible(true);
    }
    @Action
    public void btnCategoriaChamadoActionPerformed() {

        try{
            if(formCategoriaChamado==null)
            {
                formCategoriaChamado = new FormCategoriaChamado(usuarioLogado);
            }
            jDeskPnlChildForms.add(formCategoriaChamado);
        }catch(Exception excessao){

        }
        formCategoriaChamado.setVisible(true);
    }

    @Action
    public void btnAlterarSenhaActionPerformed() {
        // TODO add your handling code here:
        try{
            if(formAlterarSenha==null)
            {
                formAlterarSenha = new FormAlterarSenha(usuarioLogado);
            }
            jDeskPnlChildForms.add(formAlterarSenha);
        }catch(Exception excessao){

        }
        formAlterarSenha.setVisible(true);
    }

    @Action
    public void btnEncerrarChamadoActionPerformed() {
        // TODO add your handling code here:
        try{
           if(formEncerramentoChamados==null)
           {
               formEncerramentoChamados = new FormEncerramentoChamados(this.usuarioLogado);
           }
           jDeskPnlChildForms.add(formEncerramentoChamados);
        }catch(Exception excessao){

        }
        formEncerramentoChamados.setVisible(true);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAbrirChamado;
    private javax.swing.JButton btnCategoriaChamado;
    private javax.swing.JButton btnCidade;
    private javax.swing.JButton btnDivisao;
    private javax.swing.JButton btnEstado;
    private javax.swing.JButton btnSetor;
    private javax.swing.JButton btnUnidade;
    private javax.swing.JButton btnUsuario;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JDesktopPane jDeskPnlChildForms;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField txfUsuarioLogado;
    // End of variables declaration//GEN-END:variables

    //DECLARAÇÃO DE TODOS OS FORMULÁRIOS
    private FormAberturaChamados formAberturaChamados;
    private FormAlterarSenha formAlterarSenha;
    private FormCategoriaChamado formCategoriaChamado;
    private FormCidades formCidades;
    private FormEncerramentoChamados formEncerramentoChamados;
    private FormEstados formEstados;
    private FormLocal formLocal;
    private FormLogin formLogin;
    private FormSetor formSetor;
    private FormUnidade formUnidade;
    private FormUsuariosAcessos formUsuariosAcessos;
    //FIM DE DECLARAÇÃO DOS FORMULÁRIOS


}
